<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>papyros.task</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >papyros documentation</th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="papyros-module.html">Package&nbsp;papyros</a> ::
        Module&nbsp;task
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="papyros.task-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="papyros.task-module.html">Module papyros.task</a></h1>
<pre class="py-src">
<a name="L1"></a><tt class="py-lineno">  1</tt>  <tt class="py-line"><tt class="py-docstring">'''Base L{Task} class and friends.'''</tt> </tt>
<a name="L2"></a><tt class="py-lineno">  2</tt>  <tt class="py-line"> </tt>
<a name="L3"></a><tt class="py-lineno">  3</tt>  <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'Task'</tt><tt class="py-op">,</tt> <tt class="py-string">'UnprocessedTaskError'</tt><tt class="py-op">]</tt> </tt>
<a name="L4"></a><tt class="py-lineno">  4</tt>  <tt class="py-line"> </tt>
<a name="L5"></a><tt class="py-lineno">  5</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> </tt>
<a name="L6"></a><tt class="py-lineno">  6</tt>  <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">traceback</tt> </tt>
<a name="L7"></a><tt class="py-lineno">  7</tt>  <tt class="py-line"> </tt>
<a name="L8"></a><tt class="py-lineno">  8</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package papyros=papyros-module.html"><a title="papyros" class="py-name" href="#" onclick="return doclink('link-0', 'papyros', 'link-0');">papyros</a></tt> <tt class="py-keyword">import</tt> <tt id="link-1" class="py-name" targets="Variable papyros.log=papyros-module.html#log"><a title="papyros.log" class="py-name" href="#" onclick="return doclink('link-1', 'log', 'link-1');">log</a></tt> </tt>
<a name="L9"></a><tt class="py-lineno">  9</tt>  <tt class="py-line"> </tt>
<a name="L10"></a><tt class="py-lineno"> 10</tt>  <tt class="py-line"> </tt>
<a name="UnprocessedTaskError"></a><div id="UnprocessedTaskError-def"><a name="L11"></a><tt class="py-lineno"> 11</tt> <a class="py-toggle" href="#" id="UnprocessedTaskError-toggle" onclick="return toggle('UnprocessedTaskError');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="papyros.task.UnprocessedTaskError-class.html">UnprocessedTaskError</a><tt class="py-op">(</tt><tt class="py-base-class">Exception</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="UnprocessedTaskError-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="UnprocessedTaskError-expanded"><a name="L12"></a><tt class="py-lineno"> 12</tt>  <tt class="py-line">    <tt class="py-docstring">'''Attempted to get the result of a L{Task} that has not been executed yet.'''</tt> </tt>
</div><a name="L13"></a><tt class="py-lineno"> 13</tt>  <tt class="py-line"> </tt>
<a name="L14"></a><tt class="py-lineno"> 14</tt>  <tt class="py-line"> </tt>
<a name="Task"></a><div id="Task-def"><a name="L15"></a><tt class="py-lineno"> 15</tt> <a class="py-toggle" href="#" id="Task-toggle" onclick="return toggle('Task');">-</a><tt class="py-line"><tt class="py-keyword">class</tt> <a class="py-def-name" href="papyros.task.Task-class.html">Task</a><tt class="py-op">(</tt><tt class="py-base-class">object</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="Task-expanded"><a name="L16"></a><tt class="py-lineno"> 16</tt>  <tt class="py-line">    <tt class="py-docstring">'''Abstract base class of a callable to be called later.</tt> </tt>
<a name="L17"></a><tt class="py-lineno"> 17</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L18"></a><tt class="py-lineno"> 18</tt>  <tt class="py-line"><tt class="py-docstring">    It stores the result or raised exception of the last time it is called.</tt> </tt>
<a name="L19"></a><tt class="py-lineno"> 19</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L20"></a><tt class="py-lineno"> 20</tt>  <tt class="py-line"><tt class="py-docstring">    @cvar task_attr: If True, an exception C{exc} raised by this task refers to</tt> </tt>
<a name="L21"></a><tt class="py-lineno"> 21</tt>  <tt class="py-line"><tt class="py-docstring">        it (actually to a copy of it) as C{exc.task}.</tt> </tt>
<a name="L22"></a><tt class="py-lineno"> 22</tt>  <tt class="py-line"><tt class="py-docstring">    @cvar traceback_attr: If True, an exception C{exc} raised by this task</tt> </tt>
<a name="L23"></a><tt class="py-lineno"> 23</tt>  <tt class="py-line"><tt class="py-docstring">        refers to the string representation of the traceback as C{exc.traceback}.</tt> </tt>
<a name="L24"></a><tt class="py-lineno"> 24</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L25"></a><tt class="py-lineno"> 25</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar args: The positional arguments of this task.</tt> </tt>
<a name="L26"></a><tt class="py-lineno"> 26</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar kwds: The keyword arguments of this task.</tt> </tt>
<a name="L27"></a><tt class="py-lineno"> 27</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar _str: A string representation of this task.</tt> </tt>
<a name="L28"></a><tt class="py-lineno"> 28</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar _exception: The exception last raised when executing this task, or None.</tt> </tt>
<a name="L29"></a><tt class="py-lineno"> 29</tt>  <tt class="py-line"><tt class="py-docstring">    @ivar _result: The result of the last execution of this task (if no exception</tt> </tt>
<a name="L30"></a><tt class="py-lineno"> 30</tt>  <tt class="py-line"><tt class="py-docstring">        was raised).</tt> </tt>
<a name="L31"></a><tt class="py-lineno"> 31</tt>  <tt class="py-line"><tt class="py-docstring">    '''</tt> </tt>
<a name="L32"></a><tt class="py-lineno"> 32</tt>  <tt class="py-line"> </tt>
<a name="L33"></a><tt class="py-lineno"> 33</tt>  <tt class="py-line">    <tt class="py-name">__slots__</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">'args'</tt><tt class="py-op">,</tt> <tt class="py-string">'kwds'</tt><tt class="py-op">,</tt> <tt class="py-string">'_str'</tt><tt class="py-op">,</tt> <tt class="py-string">'_exception'</tt><tt class="py-op">,</tt> <tt class="py-string">'_result'</tt><tt class="py-op">)</tt> </tt>
<a name="L34"></a><tt class="py-lineno"> 34</tt>  <tt class="py-line"> </tt>
<a name="L35"></a><tt class="py-lineno"> 35</tt>  <tt class="py-line">    <tt id="link-2" class="py-name" targets="Variable papyros.task.Task.task_attr=papyros.task.Task-class.html#task_attr"><a title="papyros.task.Task.task_attr" class="py-name" href="#" onclick="return doclink('link-2', 'task_attr', 'link-2');">task_attr</a></tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L36"></a><tt class="py-lineno"> 36</tt>  <tt class="py-line">    <tt id="link-3" class="py-name" targets="Variable papyros.task.Task.traceback_attr=papyros.task.Task-class.html#traceback_attr"><a title="papyros.task.Task.traceback_attr" class="py-name" href="#" onclick="return doclink('link-3', 'traceback_attr', 'link-3');">traceback_attr</a></tt> <tt class="py-op">=</tt> <tt class="py-name">False</tt> </tt>
<a name="L37"></a><tt class="py-lineno"> 37</tt>  <tt class="py-line"> </tt>
<a name="Task.__init__"></a><div id="Task.__init__-def"><a name="L38"></a><tt class="py-lineno"> 38</tt> <a class="py-toggle" href="#" id="Task.__init__-toggle" onclick="return toggle('Task.__init__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#__init__">__init__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwds</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__init__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__init__-expanded"><a name="L39"></a><tt class="py-lineno"> 39</tt>  <tt class="py-line">        <tt class="py-docstring">'''Initialize this task.</tt> </tt>
<a name="L40"></a><tt class="py-lineno"> 40</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L41"></a><tt class="py-lineno"> 41</tt>  <tt class="py-line"><tt class="py-docstring">        @param args, kwds: The positional and/or keyword arguments to be passed</tt> </tt>
<a name="L42"></a><tt class="py-lineno"> 42</tt>  <tt class="py-line"><tt class="py-docstring">        to the callable this task encapsulates.</tt> </tt>
<a name="L43"></a><tt class="py-lineno"> 43</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L44"></a><tt class="py-lineno"> 44</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Variable papyros.execute.CompositeTask.args=papyros.execute.CompositeTask-class.html#args,Variable papyros.execute.IndexedTask.args=papyros.execute.IndexedTask-class.html#args,Variable papyros.task.Task.args=papyros.task.Task-class.html#args"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-4', 'args', 'link-4');">args</a></tt> <tt class="py-op">=</tt> <tt id="link-5" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-5', 'args', 'link-4');">args</a></tt> </tt>
<a name="L45"></a><tt class="py-lineno"> 45</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-6" class="py-name" targets="Variable papyros.execute.CompositeTask.kwds=papyros.execute.CompositeTask-class.html#kwds,Variable papyros.execute.IndexedTask.kwds=papyros.execute.IndexedTask-class.html#kwds,Variable papyros.task.Task.kwds=papyros.task.Task-class.html#kwds"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-6', 'kwds', 'link-6');">kwds</a></tt> <tt class="py-op">=</tt> <tt id="link-7" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-7', 'kwds', 'link-6');">kwds</a></tt> </tt>
<a name="L46"></a><tt class="py-lineno"> 46</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-8" class="py-name" targets="Variable papyros.execute.CompositeTask._exception=papyros.execute.CompositeTask-class.html#_exception,Variable papyros.execute.IndexedTask._exception=papyros.execute.IndexedTask-class.html#_exception,Variable papyros.task.Task._exception=papyros.task.Task-class.html#_exception"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-8', '_exception', 'link-8');">_exception</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L47"></a><tt class="py-lineno"> 47</tt>  <tt class="py-line">        <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-9" class="py-name" targets="Variable papyros.execute.CompositeTask._str=papyros.execute.CompositeTask-class.html#_str,Variable papyros.execute.IndexedTask._str=papyros.execute.IndexedTask-class.html#_str,Variable papyros.task.Task._str=papyros.task.Task-class.html#_str"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-9', '_str', 'link-9');">_str</a></tt> <tt class="py-op">=</tt> <tt class="py-string">'%s.%s(%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">.</tt><tt class="py-name">__module__</tt><tt class="py-op">,</tt> </tt>
<a name="L48"></a><tt class="py-lineno"> 48</tt>  <tt class="py-line">                                   <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt> <tt class="py-op">.</tt><tt class="py-name">__name__</tt><tt class="py-op">,</tt> </tt>
<a name="L49"></a><tt class="py-lineno"> 49</tt>  <tt class="py-line">                                   <tt class="py-string">', '</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">repr</tt><tt class="py-op">(</tt><tt class="py-name">arg</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">arg</tt> <tt class="py-keyword">in</tt> <tt id="link-10" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-10', 'args', 'link-4');">args</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L50"></a><tt class="py-lineno"> 50</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt id="link-11" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-11', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">:</tt> </tt>
<a name="L51"></a><tt class="py-lineno"> 51</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-12', '_str', 'link-9');">_str</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-13', '_str', 'link-9');">_str</a></tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-op">-</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
<a name="L52"></a><tt class="py-lineno"> 52</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt id="link-14" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-14', 'args', 'link-4');">args</a></tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-15" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-15', '_str', 'link-9');">_str</a></tt> <tt class="py-op">+=</tt> <tt class="py-string">', '</tt> </tt>
<a name="L53"></a><tt class="py-lineno"> 53</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-16" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-16', '_str', 'link-9');">_str</a></tt> <tt class="py-op">+=</tt> <tt class="py-string">'%s)'</tt> <tt class="py-op">%</tt> <tt class="py-string">', '</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-string">'%s=%r'</tt> <tt class="py-op">%</tt> <tt class="py-name">item</tt> <tt class="py-keyword">for</tt> <tt class="py-name">item</tt> <tt class="py-keyword">in</tt> <tt id="link-17" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-17', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">.</tt><tt class="py-name">iteritems</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div><a name="L54"></a><tt class="py-lineno"> 54</tt>  <tt class="py-line"> </tt>
<a name="Task.__repr__"></a><div id="Task.__repr__-def"><a name="L55"></a><tt class="py-lineno"> 55</tt> <a class="py-toggle" href="#" id="Task.__repr__-toggle" onclick="return toggle('Task.__repr__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#__repr__">__repr__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__repr__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__repr__-expanded"><a name="L56"></a><tt class="py-lineno"> 56</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-18', '_str', 'link-9');">_str</a></tt> </tt>
</div><a name="L57"></a><tt class="py-lineno"> 57</tt>  <tt class="py-line"> </tt>
<a name="Task.result"></a><div id="Task.result-def"><a name="L58"></a><tt class="py-lineno"> 58</tt> <a class="py-toggle" href="#" id="Task.result-toggle" onclick="return toggle('Task.result');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#result">result</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.result-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.result-expanded"><a name="L59"></a><tt class="py-lineno"> 59</tt>  <tt class="py-line">        <tt class="py-docstring">'''Return the computed result for this task.</tt> </tt>
<a name="L60"></a><tt class="py-lineno"> 60</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L61"></a><tt class="py-lineno"> 61</tt>  <tt class="py-line"><tt class="py-docstring">        If an exception had been raised, it is reraised here. If the task has</tt> </tt>
<a name="L62"></a><tt class="py-lineno"> 62</tt>  <tt class="py-line"><tt class="py-docstring">        not been executed yet, L{UnprocessedTaskError} is raised.</tt> </tt>
<a name="L63"></a><tt class="py-lineno"> 63</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L64"></a><tt class="py-lineno"> 64</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-19" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-19', '_exception', 'link-8');">_exception</a></tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
<a name="L65"></a><tt class="py-lineno"> 65</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-20" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-20', '_exception', 'link-8');">_exception</a></tt> </tt>
<a name="L66"></a><tt class="py-lineno"> 66</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> <tt class="py-keyword">return</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-21" class="py-name" targets="Variable papyros.execute.CompositeTask._result=papyros.execute.CompositeTask-class.html#_result,Variable papyros.execute.IndexedTask._result=papyros.execute.IndexedTask-class.html#_result,Variable papyros.task.Task._result=papyros.task.Task-class.html#_result"><a title="papyros.execute.CompositeTask._result
papyros.execute.IndexedTask._result
papyros.task.Task._result" class="py-name" href="#" onclick="return doclink('link-21', '_result', 'link-21');">_result</a></tt> </tt>
<a name="L67"></a><tt class="py-lineno"> 67</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">AttributeError</tt><tt class="py-op">:</tt> </tt>
<a name="L68"></a><tt class="py-lineno"> 68</tt>  <tt class="py-line">            <tt class="py-keyword">raise</tt> <tt id="link-22" class="py-name" targets="Class papyros.task.UnprocessedTaskError=papyros.task.UnprocessedTaskError-class.html"><a title="papyros.task.UnprocessedTaskError" class="py-name" href="#" onclick="return doclink('link-22', 'UnprocessedTaskError', 'link-22');">UnprocessedTaskError</a></tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
</div><a name="L69"></a><tt class="py-lineno"> 69</tt>  <tt class="py-line"> </tt>
<a name="Task.execute"></a><div id="Task.execute-def"><a name="L70"></a><tt class="py-lineno"> 70</tt> <a class="py-toggle" href="#" id="Task.execute-toggle" onclick="return toggle('Task.execute');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#execute">execute</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.execute-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.execute-expanded"><a name="L71"></a><tt class="py-lineno"> 71</tt>  <tt class="py-line">        <tt class="py-docstring">'''Execute this task and store the result or raised exception.</tt> </tt>
<a name="L72"></a><tt class="py-lineno"> 72</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L73"></a><tt class="py-lineno"> 73</tt>  <tt class="py-line"><tt class="py-docstring">        Intended to be called by L{workers &lt;Worker&gt;} only.</tt> </tt>
<a name="L74"></a><tt class="py-lineno"> 74</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L75"></a><tt class="py-lineno"> 75</tt>  <tt class="py-line">        <tt class="py-keyword">try</tt><tt class="py-op">:</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-23" class="py-name"><a title="papyros.execute.CompositeTask._result
papyros.execute.IndexedTask._result
papyros.task.Task._result" class="py-name" href="#" onclick="return doclink('link-23', '_result', 'link-21');">_result</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-24" class="py-name" targets="Method papyros.execute.CompositeTask._execute()=papyros.execute.CompositeTask-class.html#_execute,Method papyros.execute.IndexedTask._execute()=papyros.execute.IndexedTask-class.html#_execute,Method papyros.task.Task._execute()=papyros.task.Task-class.html#_execute"><a title="papyros.execute.CompositeTask._execute
papyros.execute.IndexedTask._execute
papyros.task.Task._execute" class="py-name" href="#" onclick="return doclink('link-24', '_execute', 'link-24');">_execute</a></tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-25" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-25', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-26" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-26', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">)</tt> </tt>
<a name="L76"></a><tt class="py-lineno"> 76</tt>  <tt class="py-line">        <tt class="py-keyword">except</tt> <tt class="py-name">Exception</tt><tt class="py-op">,</tt> <tt class="py-name">ex</tt><tt class="py-op">:</tt> </tt>
<a name="L77"></a><tt class="py-lineno"> 77</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-27" class="py-name"><a title="papyros.task.Task.traceback_attr" class="py-name" href="#" onclick="return doclink('link-27', 'traceback_attr', 'link-3');">traceback_attr</a></tt><tt class="py-op">:</tt> </tt>
<a name="L78"></a><tt class="py-lineno"> 78</tt>  <tt class="py-line">                <tt class="py-name">ex_type</tt><tt class="py-op">,</tt> <tt class="py-name">ex</tt><tt class="py-op">,</tt> <tt class="py-name">tb</tt> <tt class="py-op">=</tt> <tt class="py-name">sys</tt><tt class="py-op">.</tt><tt class="py-name">exc_info</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
<a name="L79"></a><tt class="py-lineno"> 79</tt>  <tt class="py-line">                <tt class="py-comment"># omit the current level of the traceback; start from the next</tt> </tt>
<a name="L80"></a><tt class="py-lineno"> 80</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-name">ex</tt><tt class="py-op">.</tt><tt class="py-name">traceback</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-name">traceback</tt><tt class="py-op">.</tt><tt class="py-name">format_exception</tt><tt class="py-op">(</tt><tt class="py-name">ex_type</tt><tt class="py-op">,</tt> <tt class="py-name">ex</tt><tt class="py-op">,</tt> </tt>
<a name="L81"></a><tt class="py-lineno"> 81</tt>  <tt class="py-line">                                                                  <tt class="py-name">tb</tt><tt class="py-op">.</tt><tt class="py-name">tb_next</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<a name="L82"></a><tt class="py-lineno"> 82</tt>  <tt class="py-line">                <tt class="py-comment"># break the cyclic reference between the traceback and this frame</tt> </tt>
<a name="L83"></a><tt class="py-lineno"> 83</tt>  <tt class="py-line"><tt class="py-comment"></tt>                <tt class="py-keyword">del</tt> <tt class="py-name">tb</tt> </tt>
<a name="L84"></a><tt class="py-lineno"> 84</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-28" class="py-name"><a title="papyros.task.Task.task_attr" class="py-name" href="#" onclick="return doclink('link-28', 'task_attr', 'link-2');">task_attr</a></tt><tt class="py-op">:</tt> </tt>
<a name="L85"></a><tt class="py-lineno"> 85</tt>  <tt class="py-line">                <tt class="py-name">ex</tt><tt class="py-op">.</tt><tt id="link-29" class="py-name" targets="Module papyros.task=papyros.task-module.html"><a title="papyros.task" class="py-name" href="#" onclick="return doclink('link-29', 'task', 'link-29');">task</a></tt> <tt class="py-op">=</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt class="py-name">__class__</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-30" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-30', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-31" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-31', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">)</tt> </tt>
<a name="L86"></a><tt class="py-lineno"> 86</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-32" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-32', '_exception', 'link-8');">_exception</a></tt> <tt class="py-op">=</tt> <tt class="py-name">ex</tt> </tt>
<a name="L87"></a><tt class="py-lineno"> 87</tt>  <tt class="py-line">            <tt id="link-33" class="py-name"><a title="papyros.log" class="py-name" href="#" onclick="return doclink('link-33', 'log', 'link-1');">log</a></tt><tt class="py-op">.</tt><tt class="py-name">debug</tt><tt class="py-op">(</tt><tt class="py-string">'Failed to execute task %s'</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
<a name="L88"></a><tt class="py-lineno"> 88</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L89"></a><tt class="py-lineno"> 89</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-34" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-34', '_exception', 'link-8');">_exception</a></tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt> </tt>
<a name="L90"></a><tt class="py-lineno"> 90</tt>  <tt class="py-line">            <tt id="link-35" class="py-name"><a title="papyros.log" class="py-name" href="#" onclick="return doclink('link-35', 'log', 'link-1');">log</a></tt><tt class="py-op">.</tt><tt class="py-name">debug</tt><tt class="py-op">(</tt><tt class="py-string">'Task %s was executed successfully'</tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">)</tt> </tt>
</div><a name="L91"></a><tt class="py-lineno"> 91</tt>  <tt class="py-line"> </tt>
<a name="Task._execute"></a><div id="Task._execute-def"><a name="L92"></a><tt class="py-lineno"> 92</tt> <a class="py-toggle" href="#" id="Task._execute-toggle" onclick="return toggle('Task._execute');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#_execute">_execute</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-op">*</tt><tt class="py-param">args</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwds</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task._execute-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task._execute-expanded"><a name="L93"></a><tt class="py-lineno"> 93</tt>  <tt class="py-line">        <tt class="py-docstring">'''Abstract method for executing this task.</tt> </tt>
<a name="L94"></a><tt class="py-lineno"> 94</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L95"></a><tt class="py-lineno"> 95</tt>  <tt class="py-line"><tt class="py-docstring">        This method should have the same signature with __init__. It can be</tt> </tt>
<a name="L96"></a><tt class="py-lineno"> 96</tt>  <tt class="py-line"><tt class="py-docstring">        implemented either explicitly in a concrete subclass or implicitly by</tt> </tt>
<a name="L97"></a><tt class="py-lineno"> 97</tt>  <tt class="py-line"><tt class="py-docstring">        decorating a callable with the L{subclass} decorator.</tt> </tt>
<a name="L98"></a><tt class="py-lineno"> 98</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L99"></a><tt class="py-lineno"> 99</tt>  <tt class="py-line">        <tt class="py-keyword">raise</tt> <tt class="py-name">NotImplementedError</tt><tt class="py-op">(</tt><tt class="py-string">'Abstract method'</tt><tt class="py-op">)</tt> </tt>
</div><a name="L100"></a><tt class="py-lineno">100</tt>  <tt class="py-line"> </tt>
<a name="Task.__getstate__"></a><div id="Task.__getstate__-def"><a name="L101"></a><tt class="py-lineno">101</tt> <a class="py-toggle" href="#" id="Task.__getstate__-toggle" onclick="return toggle('Task.__getstate__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#__getstate__">__getstate__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__getstate__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__getstate__-expanded"><a name="L102"></a><tt class="py-lineno">102</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">,</tt> <tt class="py-string">'_result'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L103"></a><tt class="py-lineno">103</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-36" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-36', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-37" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-37', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-38" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-38', '_str', 'link-9');">_str</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-39" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-39', '_exception', 'link-8');">_exception</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-40" class="py-name"><a title="papyros.execute.CompositeTask._result
papyros.execute.IndexedTask._result
papyros.task.Task._result" class="py-name" href="#" onclick="return doclink('link-40', '_result', 'link-21');">_result</a></tt><tt class="py-op">)</tt> </tt>
<a name="L104"></a><tt class="py-lineno">104</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L105"></a><tt class="py-lineno">105</tt>  <tt class="py-line">            <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-41" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-41', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-42" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-42', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-43" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-43', '_str', 'link-9');">_str</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-44" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-44', '_exception', 'link-8');">_exception</a></tt><tt class="py-op">)</tt> </tt>
</div><a name="L106"></a><tt class="py-lineno">106</tt>  <tt class="py-line"> </tt>
<a name="Task.__setstate__"></a><div id="Task.__setstate__-def"><a name="L107"></a><tt class="py-lineno">107</tt> <a class="py-toggle" href="#" id="Task.__setstate__-toggle" onclick="return toggle('Task.__setstate__');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#__setstate__">__setstate__</a><tt class="py-op">(</tt><tt class="py-param">self</tt><tt class="py-op">,</tt> <tt class="py-param">state</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.__setstate__-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.__setstate__-expanded"><a name="L108"></a><tt class="py-lineno">108</tt>  <tt class="py-line">        <tt class="py-keyword">if</tt> <tt class="py-name">len</tt><tt class="py-op">(</tt><tt class="py-name">state</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-number">5</tt><tt class="py-op">:</tt> </tt>
<a name="L109"></a><tt class="py-lineno">109</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-45" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-45', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-46" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-46', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-47" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-47', '_str', 'link-9');">_str</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-48" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-48', '_exception', 'link-8');">_exception</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-49" class="py-name"><a title="papyros.execute.CompositeTask._result
papyros.execute.IndexedTask._result
papyros.task.Task._result" class="py-name" href="#" onclick="return doclink('link-49', '_result', 'link-21');">_result</a></tt> <tt class="py-op">=</tt> <tt class="py-name">state</tt> </tt>
<a name="L110"></a><tt class="py-lineno">110</tt>  <tt class="py-line">        <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
<a name="L111"></a><tt class="py-lineno">111</tt>  <tt class="py-line">            <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-50" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-50', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-51" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-51', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-52" class="py-name"><a title="papyros.execute.CompositeTask._str
papyros.execute.IndexedTask._str
papyros.task.Task._str" class="py-name" href="#" onclick="return doclink('link-52', '_str', 'link-9');">_str</a></tt><tt class="py-op">,</tt> <tt class="py-name">self</tt><tt class="py-op">.</tt><tt id="link-53" class="py-name"><a title="papyros.execute.CompositeTask._exception
papyros.execute.IndexedTask._exception
papyros.task.Task._exception" class="py-name" href="#" onclick="return doclink('link-53', '_exception', 'link-8');">_exception</a></tt> <tt class="py-op">=</tt> <tt class="py-name">state</tt> </tt>
</div><a name="L112"></a><tt class="py-lineno">112</tt>  <tt class="py-line"> </tt>
<a name="L113"></a><tt class="py-lineno">113</tt>  <tt class="py-line">    <tt class="py-decorator">@</tt><tt class="py-decorator">classmethod</tt> </tt>
<a name="Task.subclass"></a><div id="Task.subclass-def"><a name="L114"></a><tt class="py-lineno">114</tt> <a class="py-toggle" href="#" id="Task.subclass-toggle" onclick="return toggle('Task.subclass');">-</a><tt class="py-line">    <tt class="py-keyword">def</tt> <a class="py-def-name" href="papyros.task.Task-class.html#subclass">subclass</a><tt class="py-op">(</tt><tt class="py-param">cls</tt><tt class="py-op">,</tt> <tt class="py-op">**</tt><tt class="py-param">kwds</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="Task.subclass-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="Task.subclass-expanded"><a name="L115"></a><tt class="py-lineno">115</tt>  <tt class="py-line">        <tt class="py-docstring">'''Return a decorator C{deco(f)} that binds a function C{f} as the</tt> </tt>
<a name="L116"></a><tt class="py-lineno">116</tt>  <tt class="py-line"><tt class="py-docstring">        L{_execute} method of a dynamically generated subclass of this class</tt> </tt>
<a name="L117"></a><tt class="py-lineno">117</tt>  <tt class="py-line"><tt class="py-docstring">        (C{cls}).</tt> </tt>
<a name="L118"></a><tt class="py-lineno">118</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<a name="L119"></a><tt class="py-lineno">119</tt>  <tt class="py-line"><tt class="py-docstring">        @keyword task_attr: See L{Task.task_attr}.</tt> </tt>
<a name="L120"></a><tt class="py-lineno">120</tt>  <tt class="py-line"><tt class="py-docstring">        @keyword traceback_attr: See L{Task.traceback_attr}.</tt> </tt>
<a name="L121"></a><tt class="py-lineno">121</tt>  <tt class="py-line"><tt class="py-docstring">        '''</tt> </tt>
<a name="L122"></a><tt class="py-lineno">122</tt>  <tt class="py-line">        <tt class="py-keyword">for</tt> <tt class="py-name">kwd</tt> <tt class="py-keyword">in</tt> <tt id="link-54" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-54', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">:</tt> </tt>
<a name="L123"></a><tt class="py-lineno">123</tt>  <tt class="py-line">            <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">hasattr</tt><tt class="py-op">(</tt><tt class="py-name">cls</tt><tt class="py-op">,</tt> <tt class="py-name">kwd</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<a name="L124"></a><tt class="py-lineno">124</tt>  <tt class="py-line">                <tt class="py-keyword">raise</tt> <tt class="py-name">ValueError</tt><tt class="py-op">(</tt><tt class="py-string">'Invalid keyword %r'</tt> <tt class="py-op">%</tt> <tt class="py-name">kwd</tt><tt class="py-op">)</tt> </tt>
<a name="L125"></a><tt class="py-lineno">125</tt>  <tt class="py-line">        <tt class="py-keyword">return</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">func</tt><tt class="py-op">,</tt><tt class="py-name">name</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">:</tt> <tt class="py-name">type</tt><tt class="py-op">(</tt><tt class="py-name">name</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt> <tt class="py-keyword">and</tt> <tt class="py-name">func</tt><tt class="py-op">.</tt><tt class="py-name">__name__</tt> <tt class="py-keyword">or</tt> <tt class="py-name">name</tt><tt class="py-op">,</tt> </tt>
<a name="L126"></a><tt class="py-lineno">126</tt>  <tt class="py-line">                                           <tt class="py-op">(</tt><tt class="py-name">cls</tt><tt class="py-op">,</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">dict</tt><tt class="py-op">(</tt> </tt>
<a name="L127"></a><tt class="py-lineno">127</tt>  <tt class="py-line">            <tt class="py-name">__slots__</tt>   <tt class="py-op">=</tt> <tt class="py-name">cls</tt><tt class="py-op">.</tt><tt class="py-name">__slots__</tt><tt class="py-op">,</tt> </tt>
<a name="L128"></a><tt class="py-lineno">128</tt>  <tt class="py-line">            <tt class="py-name">__module__</tt>  <tt class="py-op">=</tt> <tt class="py-name">func</tt><tt class="py-op">.</tt><tt class="py-name">__module__</tt><tt class="py-op">,</tt> </tt>
<a name="L129"></a><tt class="py-lineno">129</tt>  <tt class="py-line">            <tt class="py-name">__doc__</tt>     <tt class="py-op">=</tt> <tt class="py-name">func</tt><tt class="py-op">.</tt><tt class="py-name">__doc__</tt><tt class="py-op">,</tt> </tt>
<a name="L130"></a><tt class="py-lineno">130</tt>  <tt class="py-line">            <tt id="link-55" class="py-name"><a title="papyros.execute.CompositeTask._execute
papyros.execute.IndexedTask._execute
papyros.task.Task._execute" class="py-name" href="#" onclick="return doclink('link-55', '_execute', 'link-24');">_execute</a></tt>    <tt class="py-op">=</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">self</tt><tt class="py-op">,</tt><tt class="py-op">*</tt><tt id="link-56" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-56', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-name">kw</tt><tt class="py-op">:</tt> <tt class="py-name">func</tt><tt class="py-op">(</tt><tt class="py-op">*</tt><tt id="link-57" class="py-name"><a title="papyros.execute.CompositeTask.args
papyros.execute.IndexedTask.args
papyros.task.Task.args" class="py-name" href="#" onclick="return doclink('link-57', 'args', 'link-4');">args</a></tt><tt class="py-op">,</tt><tt class="py-op">**</tt><tt class="py-name">kw</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
<a name="L131"></a><tt class="py-lineno">131</tt>  <tt class="py-line">            <tt class="py-op">**</tt><tt id="link-58" class="py-name"><a title="papyros.execute.CompositeTask.kwds
papyros.execute.IndexedTask.kwds
papyros.task.Task.kwds" class="py-name" href="#" onclick="return doclink('link-58', 'kwds', 'link-6');">kwds</a></tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
</div></div><a name="L132"></a><tt class="py-lineno">132</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            >papyros documentation</th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0beta1 on Tue Aug 12 05:39:45 2008
    </td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
